<template>
  <div>
    <el-dialog
      title="审核流程"
      :visible.sync="dialogVisible"
      :close-on-click-modal="false"
      width="1000px"
      :lock-scroll="false"
    >
      <Flow v-if="tableData.length" :tableData="tableData" />
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">关 闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { flowApiQueryCurrentFlowInfo } from "@/api/admin/audit/flowApi.js";
import Bus from "@/utils/bus.js";
export default {
  components: {
    Flow: () =>
      import("@/views/Admin/courseLibrary/courseManage/courseOther/flow.vue"),
  },
  data() {
    return {
      dialogVisible: false,
      listQuery: {
        businessKey: "",
      },
      tableData: [],
    };
  },
  mounted() {
    Bus.$on("showDialogAuditFlow", (v) => {
      this.getList(v);
    });
  },
  beforeDestroy() {
    Bus.$off("showDialogAuditFlow");
  },
  methods: {
    getList(v) {
      let libraryType = v.sysCourse.courseType;
      let courseId = v.sysCourse.id;
      this.listQuery.businessKey = libraryType + ":" + courseId;
      flowApiQueryCurrentFlowInfo(this.listQuery).then((res) => {
        this.tableData = res.data.data;
        this.dialogVisible = true;
      });
    },
  },
};
</script>